//
//  UINavigationController+Convenience.m
//  vrmuApp
//
//  Created by ibenz on 20/07/2018.
//  Copyright © 2018 广东瑞亚传媒发展有限公司. All rights reserved.
//

#import "UINavigationController+Convenience.h"

@implementation UINavigationController (Convenience)

- (BOOL)viewControllerIsTopViewController:(UIViewController *)viewController {
	return self.viewControllers.lastObject==viewController;
}
- (BOOL)containsViewController:(UIViewController *)viewController {
	return [self.viewControllers containsObject:viewController];
}
- (BOOL)removeViewController:(UIViewController *)viewController {
	BOOL exist = [self containsViewController:viewController];
	if (exist) {
		NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.viewControllers];
		[vcs removeObject:viewController];
		[self setViewControllers:vcs];
	}
	return exist;
}

@end
